package com.sluan.service.impl;

import com.sluan.mapper.BookMapper;
import com.sluan.pojos.Book;
import com.sluan.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class BookServiceImpl implements BookService {
    @Autowired
    BookMapper bookMapper;
    @Override
    public Boolean save(Book book) {
        return bookMapper.save(book)>0;
    }

    @Override
    public Boolean update(Book book) {
        return bookMapper.update(book)>0;
    }

    @Override
    public Boolean delete(Integer id) {
        return bookMapper.delete(id)>0;
    }

    @Override
    public Book getById(Integer id) {
        return bookMapper.getById(id);
    }

    @Override
    public List<Book> getAll() {
        return bookMapper.getAll();
    }
}
